package com._520it.crm.web.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com._520it.crm.domain.Tallage;
import com._520it.crm.service.ITallageService;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class TallageController {
	@Autowired
	private ITallageService service;

	@RequestMapping("/tallage/index")
	public String index() {
		return "tallage/index";
	}

	@RequestMapping("/tallage/list/view")
	public ModelAndView selectAll(ModelAndView modelAndView,
								  @RequestParam(defaultValue = "1") int current,
								  @RequestParam(defaultValue = "10") int size
								  ) {
		modelAndView.setViewName("tallage/list");
		modelAndView.addObject("list",service.selectPage(current,size));
		modelAndView.addObject("current",current);
		modelAndView.addObject("totalCount",service.selectAll().size()/size);
		return modelAndView;
	}
}
